/* eslint valid-jsdoc: "off" */

'use strict';
const path = require('path');
/**
 * @param {Egg.EggAppInfo} appInfo app info
 */
module.exports = appInfo => {
  /**
   * built-in config
   * @type {Egg.EggAppConfig}
   **/
  const config = exports = {};

  // use for cookie sign key, should change to your own and keep security
  config.keys = appInfo.name + '_1630305627365_9352';

  // add your middleware config here
  config.middleware = [ 'error', 'logger', 'verifyToken' ];

  // add your user config here
  const userConfig = {
    // myAppName: 'egg',
    error: { // 中间件error配置
      template: path.join(__dirname, '../error.html'),
    },
    cluster: { // 进程配置
      listen: {
        port: 3000,
      },
    },
    security: { // 安全
      csrf: {
        enable: false,
      },
    },
    validate: { // 校验
      convert: true,
      validateRoot: true,
    },
    mysql: { // mysql
      client: {
        host: 'localhost',
        user: 'root',
        password: 'root@888',
        database: 'test',
        port: '3306',
      },
    },
    verifyToken: { // 中间件
      whiteList: [ '/login', '/registry' ], // login不走
    },
    multipart: {
      mode: 'file',
      allowArrayField: true,
    },
  };
  return {
    ...config,
    ...userConfig,
  };
};
